package com.databasedesign.pojo.dto;

import lombok.Data;

/**
 *向前端返回的数据
 */
@Data
public class Result {
    private Integer code;

    private String message;

    private Object data;

    public Result() {
    }

    public Result(Integer code, String message, Object data) {
        this.code = code;
        this.message = message;
        this.data = data;
    }

    public Result(Integer code, String message) {
        this.code = code;
        this.message = message;
    }

    public Result(String message) {
        this.message = message;
    }

    public Result ok() {
        Result result = new Result();
        result.setCode(200);
        result.setMessage("操作成功");
        return result;
    }
    public Result ok(String msg) {
        Result result = new Result();
        result.setCode(200);
        result.setMessage(msg);
        return result;
    }

    public Result(String message, Object data) {
        this.message = message;
        this.data = data;
    }

}
